<?php

/**
 * Scribe API 文档示例
 *
 * 这个文件包含了用于生成 API 文档的示例数据
 * 运行命令: php artisan scribe:generate
 */

return [
    // 基础查询示例
    'basic_query' => [
        'url' => '/api/posts?limit=10&page=1',
        'description' => '获取第一页的10篇文章'
    ],

    // 分类查询示例
    'category_query' => [
        'url' => '/api/posts?cat=1&limit=5',
        'description' => '获取分类ID为1的5篇文章'
    ],

    // 标签查询示例
    'tag_query' => [
        'url' => '/api/posts?tag_ids=1,2,3&limit=10',
        'description' => '获取包含标签ID 1、2、3 的文章'
    ],

    // 日期范围查询示例
    'date_range_query' => [
        'url' => '/api/posts?date_from=2024-03-01&date_to=2024-03-31',
        'description' => '获取2024年3月的文章'
    ],

    // 搜索查询示例
    'search_query' => [
        'url' => '/api/posts?s=WordPress&limit=20',
        'description' => '搜索包含"WordPress"关键词的文章'
    ],

    // 复合查询示例
    'complex_query' => [
        'url' => '/api/posts?cat_ids=1,2&not_tag_ids=5,6&author=1&date_from=2024-01-01&orderby=title&order=ASC',
        'description' => '获取分类1或2、排除标签5和6、作者ID为1、2024年以后的文章，按标题升序排列'
    ],

    // 响应示例数据
    'response_examples' => [
        'success' => [
            'code' => 200,
            'message' => '获取文章列表成功',
            'data' => [
                'list' => [
                    [
                        'id' => 1,
                        'title' => 'WordPress开发指南',
                        'slug' => 'wordpress-development-guide',
                        'excerpt' => '这是一篇关于WordPress开发的详细指南...',
                        'status' => 'publish',
                        'type' => 'post',
                        'author' => [
                            'id' => 1,
                            'name' => '张三',
                            'slug' => 'zhangsan',
                            'avatar' => 'https://example.com/avatars/zhangsan.jpg'
                        ],
                        'cover' => 'https://example.com/images/wordpress-guide-cover.jpg',
                        'images' => [
                            'https://example.com/images/screenshot1.jpg',
                            'https://example.com/images/screenshot2.jpg'
                        ],
                        'categories' => [
                            [
                                'id' => 1,
                                'name' => '技术',
                                'slug' => 'tech',
                                'description' => '技术相关文章',
                                'count' => 25
                            ],
                            [
                                'id' => 3,
                                'name' => 'WordPress',
                                'slug' => 'wordpress',
                                'description' => 'WordPress相关文章',
                                'count' => 15
                            ]
                        ],
                        'tags' => [
                            [
                                'id' => 1,
                                'name' => 'PHP',
                                'slug' => 'php',
                                'description' => 'PHP编程语言',
                                'count' => 30
                            ],
                            [
                                'id' => 2,
                                'name' => 'Laravel',
                                'slug' => 'laravel',
                                'description' => 'Laravel框架',
                                'count' => 20
                            ]
                        ],
                        'date' => [
                            'created' => '2024-03-15 10:30:00',
                            'modified' => '2024-03-16 14:20:00'
                        ],
                        'permalink' => 'https://example.com/wordpress-development-guide/',
                        'comment_count' => 5,
                        'comment_status' => 'open',
                        'row_list_options' => [
                            'list_display_data' => 'title,excerpt,date,author',
                            'image_position' => 'left',
                            'image_display' => 'cover'
                        ]
                    ]
                ],
                'pagination' => [
                    'current_page' => 1,
                    'limit' => 10,
                    'total' => 156,
                    'total_pages' => 16,
                    'has_next_page' => true,
                    'has_prev_page' => false
                ]
            ]
        ],

        'validation_error' => [
            'code' => 422,
            'message' => '日期格式必须为 YYYY-MM-DD，如：2024-03-15',
            'data' => [
                'validation_errors' => [
                    'date' => ['日期格式必须为 YYYY-MM-DD，如：2024-03-15']
                ]
            ]
        ],

        'server_error' => [
            'code' => 500,
            'message' => '查询文章列表失败: 数据库连接超时',
            'data' => null
        ]
    ],

    // 参数说明
    'parameter_descriptions' => [
        'post_type' => [
            'description' => '文章类型',
            'type' => 'string',
            'default' => 'post',
            'options' => ['post', 'page', 'attachment', 'custom_post_type']
        ],
        'post_status' => [
            'description' => '文章状态',
            'type' => 'string',
            'default' => 'publish',
            'options' => ['publish', 'private', 'draft', 'pending', 'future', 'trash', 'inherit']
        ],
        'orderby' => [
            'description' => '排序字段',
            'type' => 'string',
            'default' => 'date',
            'options' => ['date', 'title', 'menu_order', 'rand', 'ID', 'author', 'name', 'modified', 'comment_count']
        ],
        'order' => [
            'description' => '排序方式',
            'type' => 'string',
            'default' => 'DESC',
            'options' => ['ASC', 'DESC']
        ]
    ]
];
